]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceThumbnail: Don't keep stale clones in list
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 9 Jul 2018 10:19:00 +0000 (12:19 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 9 Jul 2018 11:00:35 +0000 (13:00 +0200)
If a clone gets destroyed before the corresponding MetaWindow is
removed from the workspace, we will still find it in the list of
clones and try to destroy it again. Avoid the resulting warnings
by updating the list of clones immediately when a clone is destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=791233

js/ui/workspaceThumbnail.js

index db0677006acf927bab20705bce04b035af4fbd8b..68922c943d471c58a5ef79d6ac00f040ef3f514d 100644 (file)
@@ -372,16 +372,9 @@ var WorkspaceThumbnail = new Lang.Class({
     },
 
     _doRemoveWindow(metaWin) {
-        // find the position of the window in our list
-        let index = this._lookupIndex (metaWin);
-
-        if (index == -1)
-            return;
-
-        let clone = this._windows[index];
-        this._windows.splice(index, 1);
-
-        clone.destroy();
+        let clone = this._removeWindowClone(metaWin);
+        if (clone)
+            clone.destroy();
     },
 
     _doAddWindow(metaWin) {
@@ -533,6 +526,9 @@ var WorkspaceThumbnail = new Lang.Class({
         clone.connect('drag-end', () => {
             Main.overview.endWindowDrag(clone.metaWindow);
         });
+        clone.actor.connect('destroy', () => {
+            this._removeWindowClone(clone.metaWindow);
+        });
         this._contents.add_actor(clone.actor);
 
         if (this._windows.length == 0)
@@ -545,6 +541,16 @@ var WorkspaceThumbnail = new Lang.Class({
         return clone;
     },
 
+    _removeWindowClone(metaWin) {
+        // find the position of the window in our list
+        let index = this._lookupIndex (metaWin);
+
+        if (index == -1)
+            return null;
+
+        return this._windows.splice(index, 1).pop();
+    },
+
     activate(time) {
         if (this.state > ThumbnailState.NORMAL)
             return;